package cn.cdeden.knowledge.domain;

import cn.cdeden.knowledge.domain.dto.TeamRelevanceTypeDto;
import cn.cdeden.knowledge.domain.dto.TeamRoleDto;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.*;
//import io.swagger.annotations.ApiModelProperty;
import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMappers;
import jakarta.validation.constraints.NotEmpty;
import lombok.*;
import lombok.experimental.Accessors;


import java.io.Serializable;
import java.util.Date;

/**
* @author Chen
* @date 2022-11-22
*/
@Data
@Builder
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@AutoMappers({@AutoMapper(target = TeamRoleDto.class)})
@TableName("team_role")
public class TeamRole implements Serializable {
    private static final long serialVersionUID = 1L;

//    @ApiModelProperty(value = "编号")
    @TableId(type= IdType.AUTO)
    private Long id;

//    @ApiModelProperty(value = "icon图标")
    private String icon;

//    @ApiModelProperty(value = "icon颜色")
    private String iconColor;

//    @ApiModelProperty(value = "权限角色名称")
    @NotEmpty
    private String roleName;

//    @ApiModelProperty(value = "团队id")
    private String teamId;

//    @ApiModelProperty(value = "角色描述")
    private String remark;

//    @ApiModelProperty(value = "权重（1-10，由小到大，等级变低）")
    @TableField(value = "`rank`")
    private int rank;

//    @ApiModelProperty(value = "返回权限")
    private String params;

//    @ApiModelProperty(value = "创建编号")
    @TableField(fill= FieldFill.INSERT)
    private String createId;

//    @ApiModelProperty(value = "创建日期")
    @TableField(fill= FieldFill.INSERT)
    private Date createTime;

//    @ApiModelProperty(value = "更新编号")
    @TableField(fill= FieldFill.INSERT_UPDATE)
    private String updateId;

//    @ApiModelProperty(value = "更新时间")
    @TableField(fill= FieldFill.INSERT_UPDATE)
    private Date updateTime;

    public void copyFrom(TeamRole source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
